public class Student {
    // 私有成员变量
    private String name;
    private int age;

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }

    // getter 方法，用于获取姓名
    public String getName() {
        return name;
    }

    // setter 方法，用于设置姓名
    public void setName(String name) {
        this.name = name;
    }

    // getter 方法，用于获取年龄
    public int getAge() {
        return age;
    }

    // setter 方法，用于设置年龄
    public void setAge(int age) {
        if (age >= 0 && age <= 150) {
            this.age = age;
        } else {
            System.out.println("输入的年龄不合法。");
        }
    }


    public void introduce(){
        System.out.println("我是"+name+"，今年"+age);
    }

    public static void main(String[] args){
        Student student = new Student("李鸿章",26);
        student.introduce();

        student.setName("镇成功");
        student.setAge(27);
        student.introduce();
    }

}